using System;
using System.Text.RegularExpressions;
using NUnit.Framework;

namespace Bddify.Tests.Reporters
{
    public abstract class HtmlReportSpecs
    {
        protected TestableHtmlReportBuilder SUT;
        protected string HtmlString;
        protected string[] HtmlLines { get { return Regex.Split(HtmlString, "\r\n"); } }

        [SetUp]
        public void SetUp()
        {
            InitialiseSystemUnderTest();
            Given();
            When();
            GetResult();
        }

        protected virtual void InitialiseSystemUnderTest()
        {
            SUT = TestableHtmlReportBuilder.Create();
        }

        protected virtual void GetResult()
        {
            HtmlString = SUT.Html;
        }

        public virtual void Given() { }

        public virtual void When() { }
    }
}